package controllers;

import java.io.IOException;
import java.util.ArrayList;
import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import systems.CurrentDomain;
import entities.Dns;

public class HomeServlet extends HttpServlet{
	
	private static final Logger log = Logger.getLogger(HomeServlet.class.getName());
	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException {
		log.setLevel(Level.FINE);
		TreeMap<String, String> check = new TreeMap<String, String>();
		Dns dns = new Dns();
		
		ArrayList<String> domains = CurrentDomain.getDomains();
		
		request.setAttribute("dns", dns);
		request.setAttribute("domains", domains);
		request.setAttribute("check", check);
		request.setAttribute("title", "Free tool get dns information.");
		request.setAttribute("keywords", "dns lookup, name server lookup, name server, dns, dns information, dns info, soa records, dns server, dns record");
		request.setAttribute("description", "Free tool get Dns record information for a domain. Dns lookup and name server lookup information data. ");
		try {
			request.getRequestDispatcher("/pages/home.jsp").forward(request, response);
		} catch (ServletException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
